var app = getApp(),
  that;
Page({
  data: {
    date: "1995-10-25"
  },
  bindDateChange: function(e) {
    this.setData({
      date: e.detail.value
    });
  },
  formSubmit: function(e) {
    console.log('form发生了submit事件，携带数据为：', e.detail.value)
    var that = this;
    var formData = e.detail.value;
    console.log(formData)
    if (formData.yx == '') {
      wx.showToast({
        title: '邮箱不能为空！',
        icon: 'none'
      })
    } else if (formData.yx == '/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/') {
      wx.showToast({
        title: '请输入正确的邮箱地址！',
        icon: 'none'
      })
    } else if (formData.xl == '') {
      wx.showToast({
        title: '学历不能为空！',
        icon: 'none'
      })
    } else if (formData.hy == '') {
      wx.showToast({
        title: '行业不能为空！',
      })
    } else if (formData.xxdz == '') {
      wx.showToast({
        title: '地址不能为空！',
      })
    } else {
      app.getData({
        // url: app.api.regUserInfo(),
        method: 'POST',
        data: {
          // openid: wx.getStorageSync('openId'),
          // memberName: formData.userName,
          // idNumber: formData.idcard,
          // sex: formData.sex,
          // address: formData.address,
          // phone: formData.mobile,
          // isFirstcar: formData.isFirst,
          // carUser: formData.effect,
          // bakName: formData.otheruserName,
          // bakPhone: formData.othermobile,
          // memberLevelId: '100002'
        },
        ok: function(res) {
          console.log(res)
          if (res.statusCode == 200 && res.errMsg == 'request:ok') {
            if (res.data.code == 1) {
              '用户信息保存成功！' == res.data.message &&
                (wx.showLoading({
                    title: '修改中...',
                    mask: !0
                  }),
                  app.globalData.memberLevelId = res.data.data.memberLevelId,
                  wx.setStorageSync('bizUserInfo', res.data.data),
                  setTimeout(function() {
                    that.carInfo(e.detail.value, res.data.data.id)
                  }, 1000))
            } else {
              wx.showToast({
                title: res.data.message,
                icon: 'none'
              })
            }
          }
        }
      })
    }
  },
  onLoad: function(e) {
    that = this;
    if (wx.getStorageSync('bizUserInfo')) {
      that.setData({
        bizUserInfo: wx.getStorageSync('bizUserInfo')
      })
    }
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {}
});